<?php
declare (strict_types=1);

namespace app\common\model;

use ffhome\frame\model\BaseModel;
use think\facade\Db;

class TourVisitor extends BaseModel
{
    const MODEL_NAME = 'tour_visitor';

    public static function getListByUserId($userId)
    {
        $where = [['user_id', '=', $userId],];
        return Db::name(self::MODEL_NAME)->withoutField('user_id')->where($where)
            ->order('id', 'asc')->select()->toArray();
    }

    public static function getTouristListByIds(array $visitorIds)
    {
        return Db::name(self::MODEL_NAME)->field('id visitor_id,name,sex,birthday,mobile,type,credentials')
            ->where([['id', 'in', $visitorIds]])
            ->select()->toArray();
    }
}